promote int8 to int32 if int8 is not supported#585
promote int8 to int32 if int8 is not supported#58539ali wants to merge 1 commit intoRust-GPU:mainfrom
Conversation
| inst.operands[0] = Operand::LiteralBit32(32); | ||
| } | ||
|
|
||
| // fix OpConstant values: sign-extend signed 8-bit constants to 32 bits. |
There was a problem hiding this comment.
Technically, you are only sign-extending signed integers and zero-extending unsigned ones
Firestar99
left a comment
There was a problem hiding this comment.
This is incredibly dangerous, as you're promoting every single u8 to u32, regardless of where it is used. Imagine you're using OpIAddCarry and promoting that one, studdenly you're getting wrong results.
And if the single u8 delcaration is used anywhere in an OpTypePointer, even in another entry point unrelated to yours, you just back off and do nothing, meaning that unrelated code could affect whether this rewriting goes through or not.
Instead, you need to have a whitelist about what can be promoted, which is a huge rabbit hole. Feel free to read the discussion in #307 (which is linked from the issue you're trying to close).
|
oh wow thanks for the clarification, it's indeed a rabbit hole, i'll take a shot at addressing it |
fixes #409